package com.plian.system.wrapper.hr.staff;

import com.plian.Tools.DateUtil;
import com.plian.system.dto.hr.staff.SocialRelationsDTO;
import com.plian.system.entity.hr.staff.SocialRelations;
import com.plian.system.mybatis.support.BaseWrapper;
import com.plian.system.vo.hr.staff.SocialRelationsVO;
import com.plian.system.wrapper.util.CacheWrapperUtil;
import com.plian.system.wrapper.util.WrapperUtil;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import static com.plian.system.wrapper.util.WrapperConstant.DICT_CODE_TO_NAME;
import static com.plian.system.wrapper.util.WrapperConstant.SPRING;

/**
 * 家庭及社会关系包装类,返回视图层所需的字段
 *
 * @author gangan
 * @since 2019-09-30
 */
@Mapper(componentModel = SPRING, uses = {CacheWrapperUtil.class, WrapperUtil.class})
public interface SocialRelationsWrapper extends BaseWrapper<SocialRelations, SocialRelationsDTO, SocialRelationsVO> {

	@Override
	@Mappings(value = {
			@Mapping(source = "politicCountenanceId", target = "politicCountenanceName", qualifiedByName = DICT_CODE_TO_NAME),
			@Mapping(source = "birthday", target = "birthdayStr" , dateFormat = DateUtil.PATTERN_DATE_POINT)
	})
	SocialRelationsVO entityToVO(SocialRelations entity);

}
